The purpose of this notebook is to show how to use the Agilepy scientific API.
from agilepy.api.AGAnalysis import AGAnalysis
# Interactive plot
#%matplotlib widget
confFilePath = "$HOME/agilepy_conf.yaml"
AGAnalysis.getConfiguration(
evtfile="$AGILE/agilepy-test-data/test_dataset_6.0/EVT/EVT.index",
logfile="$AGILE/agilepy-test-data/test_dataset_6.0/LOG/LOG.index",
confFilePath = confFilePath,
userName = "user-xxx",
sourceName = "vela-xxx",
tmin = 433857532,
tmax = 434289532,
timetype = "TT",
glon = 263.55,
glat = -2.78,
outputDir = "$HOME/agilepy_analysis",
verboselvl = 0
)
ag = AGAnalysis(confFilePath)
Print all options of the configuration file
ag.printOptions()
{ 'ap': {'radius': 3, 'timeslot': 3600},
'input': { 'evtfile': '/Users/bulgarelli/opt/anaconda3/envs/agilepydev/agiletools/agilepy-test-data/test_dataset_6.0/EVT/EVT.index',
'logfile': '/Users/bulgarelli/opt/anaconda3/envs/agilepydev/agiletools/agilepy-test-data/test_dataset_6.0/LOG/LOG.index'},
'maps': { 'binsize': 0.25,
'energybins': [[100, 10000]],
'expstep': 4.0,
'fovbinnumber': 1,
'mapsize': 40,
'offaxisangle': 30,
'proj': 'ARC',
'projtype': 'WCS',
'spectralindex': 2.1,
'timestep': 160,
'useEDPmatrixforEXP': False},
'mle': { 'contourpoints': 40,
'edpcorrection': 0.75,
'expratio_maxthr': 15,
'expratio_minthr': 0,
'expratio_size': 10,
'expratioevaluation': True,
'fluxcorrection': 0,
'integratortype': 1,
'loccl': 5.99147,
'mindefaulttolerance': 0.01,
'minimizeralg': 'Migrad',
'minimizerdefstrategy': 2,
'minimizertype': 'Minuit',
'ranal': 10,
'ulcl': 2},
'model': { 'emax_sources': 10000,
'emin_sources': 100,
'galcoeff': [-1],
'galmode': 1,
'galmode2': 0,
'galmode2fit': 0,
'isocoeff': [-1],
'isomode': 1,
'isomode2': 0,
'isomode2fit': 0,
'modelfile': None},
'output': { 'filenameprefix': 'analysis_product',
'logfilenameprefix': 'analysis_log',
'outdir': PosixPath('/Users/bulgarelli/agilepy_analysis/vela-xxx_user-xxx_20210325-093404'),
'sourcename': 'user-xxx',
'username': 'vela-xxx',
'verboselvl': 0},
'plotting': {'twocolumns': False},
'selection': { 'albedorad': 80,
'bpointing': None,
'dq': 0,
'emax': 10000,
'emin': 100,
'filtercode': 5,
'fovradmax': 60,
'fovradmin': 0,
'glat': -2.78,
'glon': 263.550001,
'lonpole': 180,
'lpointing': None,
'maplistgen': 'None',
'phasecode': 6,
'proj': 'ARC',
'timelist': 'None',
'timetype': 'TT',
'tmax': 434289532.0,
'tmin': 433857532.0}}
Print a single section of the yaml configuration file
ag.printOptions("maps")
{ 'binsize': 0.25,
'energybins': [[100, 10000]],
'expstep': 4.0,
'fovbinnumber': 1,
'mapsize': 40,
'offaxisangle': 30,
'proj': 'ARC',
'projtype': 'WCS',
'spectralindex': 2.1,
'timestep': 160,
'useEDPmatrixforEXP': False}
Print a single option
ag.getOption("energybins")
[[100, 10000]]
Set some options
ag.setOptions(energybins=[[100,300], [300, 1000]], mapsize=50, binsize=0.4)
ag.printOptions("maps")
{ 'binsize': 0.4,
'energybins': [[100, 300], [300, 1000]],
'expstep': 4.0,
'fovbinnumber': 1,
'mapsize': 50,
'offaxisangle': 30,
'proj': 'ARC',
'projtype': 'WCS',
'spectralindex': 2.1,
'timestep': 160,
'useEDPmatrixforEXP': False}
sources = ag.loadSourcesFromCatalog("2AGL", rangeDist = (0, 25))
type(sources[0])
agilepy.core.SourceModel.Source
for s in sources:
print(s)
----------------------------------------------------------- Source name: 2AGLJ1045-5954 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 1.80893e-07 - index: 2.0414 - Source position: (287.697, -0.788886) (l,b) - Distance from map center: 24.2159 deg ----------------------------------------------------------- Source name: 2AGLJ1048-5836 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 1.54772e-07 - index: 2.00039 - Source position: (287.422, 0.423015) (l,b) - Distance from map center: 24.0778 deg ----------------------------------------------------------- Source name: 2AGLJ1045-5735 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 1.64949e-07 - index: 2.25973 - Source position: (286.672, 1.23211) (l,b) - Distance from map center: 23.4607 deg ----------------------------------------------------------- Source name: 2AGLJ1059-5233 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 3.14104e-07 - index: 1.77974 - Source position: (286.128, 6.61213) (l,b) - Distance from map center: 24.4183 deg ----------------------------------------------------------- Source name: 2AGLJ1029-5834 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 2.64853e-07 - index: 1.91101 - Source position: (285.221, -0.689424) (l,b) - Distance from map center: 21.7604 deg ----------------------------------------------------------- Source name: 2AGLJ1015-5852 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 1.91737e-07 - index: 2.03933 - Source position: (283.945, -1.85807) (l,b) - Distance from map center: 20.3987 deg ----------------------------------------------------------- Source name: 2AGLJ1020-5752 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 2.72475e-07 - index: 2.12932 - Source position: (283.95, -0.621559) (l,b) - Distance from map center: 20.5036 deg ----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) * Free parameters: none * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.69539e-06 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg ----------------------------------------------------------- Source name: 2AGLJ1020-5906 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 1.38792e-07 - index: 1.78216 - Source position: (284.629, -1.89938) (l,b) - Distance from map center: 21.0794 deg
The sources that are already present in the Sources Library will not be loaded twice.
sources_hypotesis = """
969.539e-08 263.585 -2.84083 1.71345 0 2 2AGLJ0835-4514 0.0 2 3913.06 1.34774 0.5 5 20 10000 0 100
10e-08 273.0 -1.1 2.1 1 2 NEWOURCE 0.0 0 0 0 0.5 5 20 10000 0 100
"""
with open("./sources_hyp.txt", "w") as sf:
sf.write(sources_hypotesis)
#sources = ag.loadSourcesFromFile("./sources_hyp.txt", rangeDist = (0, 25))
The selection criteria can be expressed using the following Source class’s parameters:
selectedSources = ag.selectSources('flux > 0')
len(selectedSources)
9
selectedSources = ag.selectSources('name == "2AGLJ0835-4514"')
len(selectedSources)
for s in selectedSources:
print(s)
----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) * Free parameters: none * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.69539e-06 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg
selectedSources = ag.selectSources("flux > 0 AND dist <= 2")
len(selectedSources)
for s in selectedSources:
print(s)
----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) * Free parameters: none * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.69539e-06 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg
You can fix or free the following parametes:
_sources = ag.freeSources('name == "2AGLJ0835-4514"', "flux", True, show=True)
----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) * Free parameters: flux * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.69539e-06 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg
for s in _sources:
print(s)
----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) * Free parameters: flux * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.69539e-06 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg
_sources = ag.freeSources('name == "2AGLJ0835-4514"', "index1", True)
for s in _sources:
print(s)
----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) * Free parameters: flux index1 * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.69539e-06 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg
_sources = ag.freeSources("flux > 0 AND dist <= 2", "flux", True)
#len is 0 because the flux is already free
len(_sources)
0
for s in _sources:
print(s)
Resetting the changes:
_sources = ag.freeSources('name == "2AGLJ0835-4514"', "flux", False)
ag.freeSources('name == "2AGLJ0835-4514"', "index1", False)
[<agilepy.core.SourceModel.Source at 0x7fec6812ec50>]
ag.freeSources("flux > 0 AND dist <= 2", "flux", False)
[]
deleted = ag.deleteSources('name == "2AGLJ1048-5836"').pop()
print(deleted)
----------------------------------------------------------- Source name: 2AGLJ1048-5836 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 1.54772e-07 - index: 2.00039 - Source position: (287.422, 0.423015) (l,b) - Distance from map center: 24.0778 deg
len(ag.getSources())
8
Passing a dictionary:
newSourceDict = {
"glon" : 273.0,
"glat": -1.1,
"spectrumType" : "PowerLaw",
"flux": 10e-08,
"index": 2.1
}
if ag.addSource("NEWSOURCE", newSourceDict):
print("Source loaded")
Source loaded
len(ag.getSources())
9
Passing a Source object:
type(deleted)
agilepy.core.SourceModel.Source
if ag.addSource("NEWSOURCE", deleted):
print("Source loaded")
else:
print("Source is already present in the SourcesLibrary")
2021-03-25 09:34:04,783 [WARNING ] [SourcesLibrary] The source NEWSOURCE already exists. The 'sourceObject' will not be added to the SourcesLibrary. Source is already present in the SourcesLibrary
deletedSources = ag.deleteSources('name == "NEWSOURCE"')
len(ag.getSources())
8
sources = ag.selectSources('name == "2AGLJ0835-4514"')
source = sources.pop()
source.spectrum.set("index2", 1.34774)
print(source)
----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) * Free parameters: none * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.69539e-06 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg
This method returns the selected sources affected by the change
sources = ag.freeSources('name == "2AGLJ0835-4514"', "flux", True, show=True)
----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) * Free parameters: flux * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.69539e-06 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg
Final source hypothesis for the analysis
selectedSources = ag.selectSources('flux > 0')
print(len(selectedSources))
for s in selectedSources:
print(s)
8 ----------------------------------------------------------- Source name: 2AGLJ1045-5954 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 1.80893e-07 - index: 2.0414 - Source position: (287.697, -0.788886) (l,b) - Distance from map center: 24.2159 deg ----------------------------------------------------------- Source name: 2AGLJ1045-5735 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 1.64949e-07 - index: 2.25973 - Source position: (286.672, 1.23211) (l,b) - Distance from map center: 23.4607 deg ----------------------------------------------------------- Source name: 2AGLJ1059-5233 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 3.14104e-07 - index: 1.77974 - Source position: (286.128, 6.61213) (l,b) - Distance from map center: 24.4183 deg ----------------------------------------------------------- Source name: 2AGLJ1029-5834 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 2.64853e-07 - index: 1.91101 - Source position: (285.221, -0.689424) (l,b) - Distance from map center: 21.7604 deg ----------------------------------------------------------- Source name: 2AGLJ1015-5852 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 1.91737e-07 - index: 2.03933 - Source position: (283.945, -1.85807) (l,b) - Distance from map center: 20.3987 deg ----------------------------------------------------------- Source name: 2AGLJ1020-5752 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 2.72475e-07 - index: 2.12932 - Source position: (283.95, -0.621559) (l,b) - Distance from map center: 20.5036 deg ----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) * Free parameters: flux * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.69539e-06 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg ----------------------------------------------------------- Source name: 2AGLJ1020-5906 (PointSource) * Free parameters: none * Initial source parameters: (PowerLaw) - flux(ph/cm2s): 1.38792e-07 - index: 1.78216 - Source position: (284.629, -1.89938) (l,b) - Distance from map center: 21.0794 deg
ag.printOptions("maps")
{ 'binsize': 0.4,
'energybins': [[100, 300], [300, 1000]],
'expstep': 4.0,
'fovbinnumber': 1,
'mapsize': 50,
'offaxisangle': 30,
'proj': 'ARC',
'projtype': 'WCS',
'spectralindex': 2.1,
'timestep': 160,
'useEDPmatrixforEXP': False}
maplistfile = ag.generateMaps()
Generating maps..please wait.
ag.displayCtsSkyMaps(smooth=2, regFiles=["$AGILE/catalogs/3EG_1.reg"], regFileColors=["red"], catalogRegions="2AGL", catalogRegionsColor="blue", normType="sqrt")
Generating plot..please wait.
[None]
ag.displayExpSkyMaps(singleMode = False)
Generating plot..please wait.
[None, None]
ag.displayGasSkyMaps()
Generating plot..please wait.
[None]
ag.displayCtsSkyMaps(smooth=3, saveImage=True)
Generating plot..please wait.
['/Users/bulgarelli/agilepy_analysis/vela-xxx_user-xxx_20210325-093404/plots/analysis_cts_20210325-093434.png']
print("isocoeff: {} galcoeff: {}".format(ag.getOption("isocoeff"), ag.getOption("galcoeff")))
isocoeff: [-1, -1] galcoeff: [-1, -1]
isoBkg, galBkg, maplistfile = ag.calcBkg("2AGLJ0835-4514", galcoeff = [0.7, 0.7], pastTimeWindow = 0)
Computing background coefficients..please wait. Generating maps..please wait.
# calcBkg with pastTimeWindow = 14
# ag.setOptions(galcoeff=[0.469176, 0.699403, 0.199108, 0.533379], isocoeff=[4.27314, 0.976644, 8.12386, 1.24627])
print("isocoeff: {} galcoeff: {}".format(ag.getOption("isocoeff"), ag.getOption("galcoeff")))
isocoeff: [4.08416, 3.84041] galcoeff: [0.7, 0.7]
sourceFiles = ag.mle()
#print results
sources = ag.selectSources("sqrtTS > 0", show=True)
print(len(sources))
for s in sources:
print(s)
----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) => sqrt(ts): 17.008 * Free parameters: flux * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.69539e-06 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg * Last MLE analysis: - flux(ph/cm2s): 9.01664e-06 +/- 9.19068e-07 - cutoffEnergy: 3913.06 - index1: 1.71345 - index2: 1.34774 - upper limit(ph/cm2s): 1.0951e-05 - ergLog(erg/cm2s): 1.60296e-09 +/- 1.6339e-10 - galCoeff: [0.7, 0.7] - isoCoeff: [4.08416, 3.84041] - exposure(cm2s): 18945200.0 - exp-ratio: 0.0 - L_peak: 263.585 - B_peak: -2.84083 - Distance from start pos: 8.53774e-07 - position: - L: -1.0 - B: -1.0 - Distance from start pos: -1.0 - radius of circle: -1.0 - ellipse: - a: -1.0 - b: -1.0 - phi: -1.0 ----------------------------------------------------------- 1 ----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) => sqrt(ts): 17.008 * Free parameters: flux * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.69539e-06 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg * Last MLE analysis: - flux(ph/cm2s): 9.01664e-06 +/- 9.19068e-07 - cutoffEnergy: 3913.06 - index1: 1.71345 - index2: 1.34774 - upper limit(ph/cm2s): 1.0951e-05 - ergLog(erg/cm2s): 1.60296e-09 +/- 1.6339e-10 - galCoeff: [0.7, 0.7] - isoCoeff: [4.08416, 3.84041] - exposure(cm2s): 18945200.0 - exp-ratio: 0.0 - L_peak: 263.585 - B_peak: -2.84083 - Distance from start pos: 8.53774e-07 - position: - L: -1.0 - B: -1.0 - Distance from start pos: -1.0 - radius of circle: -1.0 - ellipse: - a: -1.0 - b: -1.0 - phi: -1.0 -----------------------------------------------------------
Free also position parameter
ag.freeSources('name == "2AGLJ0835-4514"', "pos", True, show=True)
----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) => sqrt(ts): 17.008 * Free parameters: flux pos * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.69539e-06 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg * Last MLE analysis: - flux(ph/cm2s): 9.01664e-06 +/- 9.19068e-07 - cutoffEnergy: 3913.06 - index1: 1.71345 - index2: 1.34774 - upper limit(ph/cm2s): 1.0951e-05 - ergLog(erg/cm2s): 1.60296e-09 +/- 1.6339e-10 - galCoeff: [0.7, 0.7] - isoCoeff: [4.08416, 3.84041] - exposure(cm2s): 18945200.0 - exp-ratio: 0.0 - L_peak: 263.585 - B_peak: -2.84083 - Distance from start pos: 8.53774e-07 - position: - L: -1.0 - B: -1.0 - Distance from start pos: -1.0 - radius of circle: -1.0 - ellipse: - a: -1.0 - b: -1.0 - phi: -1.0 -----------------------------------------------------------
[<agilepy.core.SourceModel.Source at 0x7fec4c3010d0>]
ag.mle()
['/Users/bulgarelli/agilepy_analysis/vela-xxx_user-xxx_20210325-093404/mle/1/analysis_product_2AGLJ1045-5954.source', '/Users/bulgarelli/agilepy_analysis/vela-xxx_user-xxx_20210325-093404/mle/1/analysis_product_2AGLJ1045-5735.source', '/Users/bulgarelli/agilepy_analysis/vela-xxx_user-xxx_20210325-093404/mle/1/analysis_product_2AGLJ1059-5233.source', '/Users/bulgarelli/agilepy_analysis/vela-xxx_user-xxx_20210325-093404/mle/1/analysis_product_2AGLJ1029-5834.source', '/Users/bulgarelli/agilepy_analysis/vela-xxx_user-xxx_20210325-093404/mle/1/analysis_product_2AGLJ1015-5852.source', '/Users/bulgarelli/agilepy_analysis/vela-xxx_user-xxx_20210325-093404/mle/1/analysis_product_2AGLJ1020-5752.source', '/Users/bulgarelli/agilepy_analysis/vela-xxx_user-xxx_20210325-093404/mle/1/analysis_product_2AGLJ0835-4514.source', '/Users/bulgarelli/agilepy_analysis/vela-xxx_user-xxx_20210325-093404/mle/1/analysis_product_2AGLJ1020-5906.source']
#print results
sources = ag.selectSources("sqrtTS > 0")
print(len(sources))
for s in sources:
print(s)
1 ----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) => sqrt(ts): 17.0229 * Free parameters: flux pos * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.01664e-06 +/- 9.19068e-07 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg * Last MLE analysis: - flux(ph/cm2s): 8.98066e-06 +/- 9.15265e-07 - cutoffEnergy: 3913.06 - index1: 1.71345 - index2: 1.34774 - upper limit(ph/cm2s): 1.09073e-05 - ergLog(erg/cm2s): 1.59656e-09 +/- 1.62714e-10 - galCoeff: [0.7, 0.7] - isoCoeff: [4.08416, 3.84041] - exposure(cm2s): 18945200.0 - exp-ratio: 0.0 - L_peak: 263.638 - B_peak: -2.85605 - Distance from start pos: 0.0548425 - position: - L: 263.647 - B: -2.8547 - Distance from start pos: 0.0637012 - radius of circle: 0.199311 - ellipse: - a: 0.196811 - b: 0.202633 - phi: 42.9398 -----------------------------------------------------------
Save the results of the analysis in a reg file.
regFile = ag.writeSourcesOnFile("source_regions", "reg")
print(regFile)
/Users/bulgarelli/agilepy_analysis/vela-xxx_user-xxx_20210325-093404/sources_library/source_regions.reg
Display the result of the analysis saved in a reg file.
ag.displayCtsSkyMaps(smooth=2, regFiles=[regFile], regFileColors=["red"], catalogRegions="2AGL", catalogRegionsColor="blue")
Generating plot..please wait.
[None]
Fix the position and keep only flux free
ag.freeSources('name == "2AGLJ0835-4514"', "pos", False, show=True)
----------------------------------------------------------- Source name: 2AGLJ0835-4514 (PointSource) => sqrt(ts): 17.0229 * Free parameters: flux * Initial source parameters: (PLSuperExpCutoff) - flux(ph/cm2s): 9.01664e-06 +/- 9.19068e-07 - index1: 1.71345 - cutoffEnergy: 3913.06 - index2: 1.34774 - Source position: (263.585, -2.84083) (l,b) - Distance from map center: 0.0702 deg * Last MLE analysis: - flux(ph/cm2s): 8.98066e-06 +/- 9.15265e-07 - cutoffEnergy: 3913.06 - index1: 1.71345 - index2: 1.34774 - upper limit(ph/cm2s): 1.09073e-05 - ergLog(erg/cm2s): 1.59656e-09 +/- 1.62714e-10 - galCoeff: [0.7, 0.7] - isoCoeff: [4.08416, 3.84041] - exposure(cm2s): 18945200.0 - exp-ratio: 0.0 - L_peak: 263.638 - B_peak: -2.85605 - Distance from start pos: 0.0548425 - position: - L: 263.647 - B: -2.8547 - Distance from start pos: 0.0637012 - radius of circle: 0.199311 - ellipse: - a: 0.196811 - b: 0.202633 - phi: 42.9398 -----------------------------------------------------------
[<agilepy.core.SourceModel.Source at 0x7fec4c3010d0>]
lightCurveData = ag.lightCurveMLE("2AGLJ0835-4514", binsize=86400)
Computing light curve bins..please wait.
Generating maps..please wait.
Generating maps..please wait.
Generating maps..please wait.
Generating maps..please wait.
Generating maps..please wait.
! cat $lightCurveData
time_start_mjd time_end_mjd sqrt(ts) flux flux_err flux_ul gal gal_error iso iso_error l_peak b_peak dist_peak l b r ell_dist a b phi exposure ExpRatio counts counts_err Index Index_Err Par2 Par2_Err Par3 Par3_Err Erglog Erglog_Err Erglog_UL time_start_utc time_end_utc time_start_tt time_end_tt Fix index ULConfidenceLevel SrcLocConfLevel start_l start_b start_flux typefun par2 par3 galmode2 galmode2fit isomode2 isomode2fit edpcor fluxcor integratortype expratioEval expratio_minthr expratio_maxthr expratio_size Emin emax fovmin fovmax albedo binsize expstep phasecode 58026.49921296296 58027.49921296296 7.34802 944.077e-08 213.086e-08 1418.53e-08 0.7,0.7 0.0,0.0 4.08416,3.84041 0.0,0.0 263.647 -2.8547 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 3718660.0 0.0 35.107 7.92393 1.71345 0.0 3913.06 0.0 3913.06 0.0 1.67836e-09 3.78819e-10 2.52182e-09 2017-09-30T11:58:52 2017-10-01T11:58:52 433857532.0 433943932.0 1.0 1.71345 2.0 5.99147 263.647 -2.8547 8.98066e-06 2.0 3913.06 1.34774 0.0 0.0 0.0 0.0 0.75 0.0 1.0 1.0 0.0 15.0 10.0 100.0,300.0 300.0,1000.0 0.0,0.0 60.0,60.0 80.0 0.4 0.0 6.0 58027.49921296296 58028.49921296296 8.88107 1054.87e-08 211.633e-08 1523.64e-08 0.7,0.7 0.0,0.0 4.08416,3.84041 0.0,0.0 263.647 -2.8547 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 3843970.0 0.0 40.5489 8.1351 1.71345 0.0 3913.06 0.0 3913.06 0.0 1.87533e-09 3.76236e-10 2.7087e-09 2017-10-01T11:58:52 2017-10-02T11:58:52 433943932.0 434030332.0 1.0 1.71345 2.0 5.99147 263.647 -2.8547 8.98066e-06 2.0 3913.06 1.34774 0.0 0.0 0.0 0.0 0.75 0.0 1.0 1.0 0.0 15.0 10.0 100.0,300.0 300.0,1000.0 0.0,0.0 60.0,60.0 80.0 0.4 0.0 6.0 58028.49921296296 58029.49921296296 7.31826 820.89e-08 198.193e-08 1266.73e-08 0.7,0.7 0.0,0.0 4.08416,3.84041 0.0,0.0 263.647 -2.8547 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 3788250.0 0.0 31.0974 7.50807 1.71345 0.0 3913.06 0.0 3913.06 0.0 1.45936e-09 3.52344e-10 2.25196e-09 2017-10-02T11:58:52 2017-10-03T11:58:52 434030332.0 434116732.0 1.0 1.71345 2.0 5.99147 263.647 -2.8547 8.98066e-06 2.0 3913.06 1.34774 0.0 0.0 0.0 0.0 0.75 0.0 1.0 1.0 0.0 15.0 10.0 100.0,300.0 300.0,1000.0 0.0,0.0 60.0,60.0 80.0 0.4 0.0 6.0 58029.49921296296 58030.49921296296 6.7938 840.137e-08 208.073e-08 1306.49e-08 0.7,0.7 0.0,0.0 4.08416,3.84041 0.0,0.0 263.647 -2.8547 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 3806190.0 0.0 31.9772 7.91965 1.71345 0.0 3913.06 0.0 3913.06 0.0 1.49358e-09 3.69907e-10 2.32265e-09 2017-10-03T11:58:52 2017-10-04T11:58:52 434116732.0 434203132.0 1.0 1.71345 2.0 5.99147 263.647 -2.8547 8.98066e-06 2.0 3913.06 1.34774 0.0 0.0 0.0 0.0 0.75 0.0 1.0 1.0 0.0 15.0 10.0 100.0,300.0 300.0,1000.0 0.0,0.0 60.0,60.0 80.0 0.4 0.0 6.0 58030.49921296296 58031.49921296296 7.62835 820.045e-08 190.836e-08 1249.26e-08 0.7,0.7 0.0,0.0 4.08416,3.84041 0.0,0.0 263.647 -2.8547 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 3793810.0 0.0 31.111 7.23995 1.71345 0.0 3913.06 0.0 3913.06 0.0 1.45786e-09 3.39264e-10 2.2209e-09 2017-10-04T11:58:52 2017-10-05T11:58:52 434203132.0 434289532.0 1.0 1.71345 2.0 5.99147 263.647 -2.8547 8.98066e-06 2.0 3913.06 1.34774 0.0 0.0 0.0 0.0 0.75 0.0 1.0 1.0 0.0 15.0 10.0 100.0,300.0 300.0,1000.0 0.0,0.0 60.0,60.0 80.0 0.4 0.0 6.0
ag.displayLightCurve("mle")
Generating plot..please wait.
time_start_mjd time_end_mjd sqrt(ts) flux flux_err flux_ul gal gal_error iso iso_error l_peak b_peak dist_peak l b r ell_dist a b phi exposure ExpRatio counts counts_err Index Index_Err Par2 Par2_Err Par3 Par3_Err Erglog Erglog_Err Erglog_UL time_start_utc time_end_utc time_start_tt time_end_tt Fix index ULConfidenceLevel SrcLocConfLevel start_l start_b start_flux typefun par2 par3 galmode2 galmode2fit isomode2 isomode2fit edpcor fluxcor integratortype expratioEval expratio_minthr expratio_maxthr expratio_size Emin emax fovmin fovmax albedo binsize expstep phasecode
ag.displayGenericColumn(lightCurveData, "exposure", um="cm^2 s sr")
#ap_file, _ = ag.aperturePhotometry()
#! cat $ap_file
#ag.displayLightCurve("ap")
ag.deleteAnalysisDir()
True